# Maintainer: David Runge <dvzrv@archlinux.org>
# Maintainer: Caleb Maclennan <caleb@alerque.com>

_name=hsluv-python
pkgname=python-hsluv
pkgver=5.0.4
pkgrel=1
pkgdesc="A Python implementation of HSLuv (revision 4)"
arch=(any)
url="https://github.com/hsluv/hsluv-python"
license=(MIT)
depends=(python)
makedepends=(
  python-build
  python-installer
  python-setuptools
  python-wheel
)
checkdepends=(python-pytest)
source=($_name-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz)
sha512sums=('68b289a933f9e2b27f995519ea5b12d1b9e6e65fb81064e17f4acd5db3cb9bfd089e42a39994cf9da492a8b28a0b3aa62e6daf71fb0ae4cd5a49099064eb812c')
b2sums=('a543cb3a980a696591ec5456670d9007eb1616282905c97b79c55fa0183893026837fd606f53138c64eec466d217d34c2e79cafdf4f30788f3af67808791d771')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_name-$pkgver
  export PYTHONPATH="build:$PYTHONPATH"
  pytest -vv
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 LICENSE.txt -t "$pkgdir/usr/share/licenses/$pkgname/"
}
